< previous page page_504 next page >

Page 504
The INI Configuration File
An INI file stores the information about each call as well as the path to the WAV file you want to play for each caller. You could, of course, store this information in a database or other file, but I picked an INI file because it has low overhead and is easy to edit. A sample INI file is shown here:
[General]
ComPort=3
InitString="AT#CID=1"
CallCount=3

[XREF]
VANDELAY INDUST=Dad at Work
PIERCE JAMES J=Nelda and Jerry Pierce
TAYLOR TECHNOLOG=This is a sales call, don't answer!
MEMPHIS, TN=Cellular phone in Memphis

[Sounds]
PAY PHONE=D:\wav\Dad.wav
VANDELAY INDUST=D:\wav\Hello.Wav

[Call1]
Time=05/25 03:05 p
Number=901-362-6030
Name=LAZENBY N D

[Call2]
Time=05/25 09:31 p
Number=901-555-1212
Name=PRENTICE BRUCE

[Call3]
Time=05/26 12:43 p
Number=901-754-7222
Name=FRIDAY JOE
The INI file is divided into a few basic sections:
[SOUNDS]. This section contains the path to the WAV file for each caller name.
[XREF]. This section contains a "friendly name" to display for the caller instead of the phone company name.
[CALL##]. The program creates a new section as each call is received.
[GENERAL]. This section contains the current number of [CALL] sections as well as some initialization information.
The program uses the INI wrapper functions sGetINIString and writeINIString described in Chapter 21, "Working with Files," to manipulate the INI file.
sarrow.gifSee "Understanding INI Files," p. 484
Starting Out with the Program
The next section will focus on the new material related to the communications control. However, if you are following along, complete the following steps to get started:

 
< previous page page_504 next page >